<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>主页 | 短信平台</title>
<jsp:include page="/WEB-INF/jsp/common/commonlist.jsp"></jsp:include>
<script type="text/javascript">
	function bodyLoad(){
		activeMenuItem('messageManageItem','validateMessageItem');		
   }
	
	/**
	短信审核通过
	*/
	function auditMessage(id){
		$('#fsId').attr('value',id); 
		$("#listForm").attr("action","auditMessage.do").submit();
	}
	
	//删除信息
	function deleteMessage(id){
		var content = $('#C' + id)[0].innerText;
		if(confirm("确认要删除内容为【"+  content +"】信息吗？")){
			$('#fsId').attr('value',id);
			$("#listForm").attr("action","deleteMessage.do").submit();	
		}			
	}
	
	/**
		根据查询参数，得到列表
	*/
	function getListInfo(pageNo){
		$('#pageNo').attr("value",pageNo);
		$("#listForm").attr("action","validMessage.do").submit();
	}
	
	$(document).ready(function() {
		$("#beginDate").datepicker();
		$("#endDate").datepicker(); 
	}); 
	
	
</script>
</head>
<body onload="bodyLoad()">
<div id="body-wrapper">
  <!-- Wrapper for the radial gradient background -->
  <div id="sidebar">
    <div id="sidebar-wrapper">
      <!-- Sidebar with logo and menu -->
      <h1 id="sidebar-title"><a href="#">短信平台</a></h1> 
      <!-- Logo (221px wide) -->

      <!-- Sidebar Profile links -->
     	 <!--  页面左上角的部分 -->
     <%@include file="/WEB-INF/jsp/common/leftTop.jsp" %>
     <!-- 页面左侧菜单部分 -->
     <%@include file="/WEB-INF/jsp/common/menu.jsp" %>
    </div>
  </div>
  <!-- End #sidebar -->
  <div id="main-content">
 
   <%@ include file="/WEB-INF/jsp/common/top.jsp" %>
    <!-- End .shortcut-buttons-set -->
    <div class="clear"></div>
    <!-- End .clear -->
    <div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>审核短信</h3>
        <ul class="content-box-tabs">
        </ul>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1">
        <form action="#" method="post"  id="listForm">
        	<input type="hidden"   id="pageNo"  name="pageNo" value="${result.currPage }">        	
        	<input type="hidden" name="fsId"  value="" id="fsId">
           <table>
              <tr style="background-color: rgb(229, 229, 229);">
                <td><label style="padding-bottom: 0px;">用户名：</label></td>
                <td><input type="text" id="" name="userName"   value="${userName }" /></td>
                <td> </td>
                <td><label style="padding-bottom: 0px;">发送日期：</label></td>
                <td><input type="text" id="beginDate" name="beginDate"   value="${beginDate }"  readonly="readonly"/></td>
                <td><label style="padding-bottom: 0px;">到</label></td>
                <td><input type="text" id="endDate" name="endDate"   readonly="readonly"   value="${endDate }"/></td>
                <td><input type="button" value="查询"   onclick="getListInfo(1)"></td></tr> 
          </table>
          <table>
            <thead>
              <tr>
                <th>
                  <input class="check-all" type="checkbox" />
                </th>
                <th>用户名</th>
                <th>短信内容</th>
                <th>数量</th>
                <th>发送时间</th>
                <th>状态</th>
                <th>操作</th>
              </tr>
            </thead>
            <tfoot> 
              <tr>
                <td colspan="6">
                   <div class="bulk-actions align-left">
                    	提示：1、先审核再执行发送操作。2、若审核不通过请删除，系统将自动退费。
				  </div>
                  <div class="pagination" style="font-size: 12px;"> 
                  <a href="#"   onclick="getListInfo(1)">&laquo; 首页</a>
                  <a href="#"  onclick="getListInfo(${result.previousPage  })">&laquo; 上一页</a> 
               			  ${result.currPage}/${result.pageCount }
					 <a href="#" onclick="getListInfo(${result.nextPage })">下一页 &raquo;</a>
					 <a href="#"   onclick="getListInfo(${result.pageCount })">尾页 &raquo;</a> </div>
                  <!-- End .pagination -->
                  <div class="clear"></div>
                </td>
              </tr>
            </tfoot>
            <tbody>
            	<c:forEach items="${result.result }"    var="item"  >
		              <tr>              
		                <td>
		                  <input type="checkbox" />
		                </td>
		                <td>${item.user.realName }</td>
		                <td  id="C${item.fsId }">${item.content }</td>
		                <td>${item.totalCount }</td>
		                <td>${item.sendDate }</td>
		                <td>${item.stateName }</td>
		                <td>
		                	<c:if test="${item.state eq '00' }"><a href="#"  onclick="auditMessage('${item.fsId}')">审核通过</a>&nbsp;&nbsp;&nbsp;</c:if>		                	
		                	<c:if test="${item.state eq '10' }"><a href="#">发送信息</a>&nbsp;&nbsp;&nbsp;</c:if>
		                	<a href="#"   onclick="deleteMessage('${item.fsId}')"> 删除</a>		                	
						</td>
		              </tr>
              </c:forEach>
              
            </tbody>
          </table>
         </form>
        </div>
        <!-- End #tab1 -->
      </div>
      <!-- End .content-box-content -->
    </div>
    <!-- End .content-box -->
    <div class="clear"></div>
    <%@ include file="/WEB-INF/jsp/common/copyright.jsp" %>
  </div>
  <!-- End #main-content -->
</div>
</body>
</html>